package com.wwt.springboot_vue.service.impl;

import com.wwt.springboot_vue.bean.Order;
import com.wwt.springboot_vue.mapper.OrderMapper;
import com.wwt.springboot_vue.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional //控制事务
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public List<Order> findAll() {
        return orderMapper.findAll();
    }

    @Override
    public List<Order> findByStatus(String info) {
        return orderMapper.findByStatus(info);
    }

    @Override
    public Order findById(int order_id) {
        return orderMapper.findById(order_id);
    }

    @Override
    public void delete(Integer order_id) {
        orderMapper.delete(order_id);
    }

    @Override
    public void add(Integer user_id, Integer goods_id, String order_status, String order_time) {
        orderMapper.add(user_id, goods_id, order_status, order_time);
    }

    @Override
    public void update(Order order) {
        orderMapper.update(order);
    }

    @Override
    public List<Order> findByLimit(int start, int size) {
        return orderMapper.findByLimit(start, size);
    }

    @Override
    public List<Order> findByStatusLimit(String info, int start, int size) {
        return orderMapper.findByStatusLimit(info, start, size);
    }
}
